Cricket.Util = {
				findMonthLabel: function(MonthInd) {
					switch(MonthInd) {
						case 0: return 'January';
						case 1: return 'February';
						case 2: return 'March';
						case 3: return 'April';
						case 4: return 'May';
						case 5: return 'June';
						case 6: return 'July';
						case 7: return 'August';
						case 8: return 'September';
						case 9: return 'October';
						case 10: return 'November';
						case 11: return 'December';
						default: return '';
							
					}
				},
				findDayLabel: function(DayId) {
					switch(DayId) {
						case 1: return 'Monday';
						case 2: return 'Tuesday';
						case 3: return 'Wednesday';
						case 4: return 'Thursday';
						case 5: return 'Friday';
						case 6: return 'Saturday';
						case 0: return 'Sunday';
						default: return '';
					}
				},
				findClockLabel: function(DateObj) {
					var TimeString = (10 > DateObj.getHours()) ? '0' +DateObj.getHours() : DateObj.getHours();
					TimeString += ':';
					TimeString += (10 > DateObj.getMinutes()) ? '0' +DateObj.getMinutes() : DateObj.getMinutes();
					return TimeString;
				},
				loadAllTeams: function(parsedData) {
					var ReturnArray = [];
					if(false !== parsedData) {
						for(var i = 0; i < parsedData.length; i++ ) {
							ReturnArray.push(parsedData[i].Teams[1].fullname);	
							ReturnArray.push(parsedData[i].Teams[2].fullname);	
						}
						ReturnArray = ReturnArray.unique(); 						
					}
					return ReturnArray;
				},
				loadAllMonths: function(parsedData) {
					if(false !== parsedData) {
						var MinDate = new Date();
						var MaxDate = new Date();
						var Min = MinDate.getTime();
						var Max = MinDate.getTime();
						for(var i = 0; i < parsedData.length; i++ ) {
							//check both dates for min and max
							//find min and max timestamp
							if(typeof parsedData[i].Dates.Start == 'object') {
								if( parsedData[i].Dates.Start.getTime() < Min) {
									Min = parsedData[i].Dates.Start.getTime();
								}
								
								if(parsedData[i].Dates.Start.getTime() > Max) {
									Max = parsedData[i].Dates.Start.getTime();
								}
							}
							
							if(typeof parsedData[i].Dates.End == 'object') {
								if( parsedData[i].Dates.End.getTime() < Min) {
									Min = parsedData[i].Dates.End.getTime();
								}
								
								if(parsedData[i].Dates.End.getTime() > Max) {
									Max = parsedData[i].Dates.End.getTime();
								}
							}						
						}
						
						MinDate.setTime(Min);						
						MaxDate.setTime(Max);
							
						var ReturnArray = [];
						while(MinDate.getTime() < MaxDate.getTime()) {
							ReturnArray.push(MinDate.getMonth() + '-' + MinDate.getFullYear());
							MinDate.setTime(MinDate.getTime() + 1000*60*60*24*28);
						}
						//push max
						ReturnArray.push(MaxDate.getMonth() + '-' + MaxDate.getFullYear());
						ReturnArray = ReturnArray.unique();
						ReturnArray = ReturnArray.sort(Cricket.Util.sortDates);

						return ReturnArray;
									
					} else {
						return [Date.getMonth() + '-' + Date.getFullYear()];
					}
				},
				/*** FILTERS ***/
				drawFilters: function(ForObject) {
					//get selected Month and Team
					var SelectedMonth = Cricket.Controller.Prefs.getString('cricket_'+ForObject.TabId+'_month');
					var SelectedTeam = Cricket.Controller.Prefs.getString('cricket_'+ForObject.TabId+'_team');

					//clear existing months
					MonthDropDown = _gel(ForObject.TabId+'-months-dropdown');

					if(MonthDropDown) {
						MonthDropDown.innerHTML = '';
						//draw months
						var MonthOption = document.createElement('option');
						MonthOption.value = '';
						MonthOption.innerHTML = 'Select Month...';
						if(SelectedMonth === '') {
							MonthOption.selected = 'selected';
						} 
						MonthDropDown.appendChild(MonthOption);
						
						for(var m = 0; m < ForObject.AllMonths.length; m++) {
							var MonthOption = document.createElement('option');
							MonthOption.value = ForObject.AllMonths[m];
							var MonthArray = ForObject.AllMonths[m].split('-');
							if(2 === MonthArray.length) {
								MonthOption.innerHTML = Cricket.Util.findMonthLabel(parseInt(MonthArray[0])) + ' ' +MonthArray[1];
							} else {
								MonthOption.innerHTML = ForObject.AllMonths[m];
							}
							if(SelectedMonth === ForObject.AllMonths[m]) {
								MonthOption.selected = 'selected';
							} 
							MonthDropDown.appendChild(MonthOption);
						}
					}
					
					//clear existing months
					TeamDropDown = _gel(ForObject.TabId+'-teams-dropdown');
					if(TeamDropDown) {
						TeamDropDown.innerHTML = '';
						//draw months
						var TeamOption = document.createElement('option');
						TeamOption.value = '';
						TeamOption.innerHTML = 'Select Team....'
						if(SelectedTeam === '') {
							TeamOption.selected = 'selected';
						} 
						TeamDropDown.appendChild(TeamOption);
						for(var t = 0; t < ForObject.AllTeams.length; t++) {
							var TeamOption = document.createElement('option');
							TeamOption.value = ForObject.AllTeams[t];
							TeamOption.innerHTML = ForObject.AllTeams[t];
							if(SelectedTeam === ForObject.AllTeams[t]) {
								TeamOption.selected = 'selected';
							} 
							TeamDropDown.appendChild(TeamOption);
						}
					}
				},
				
				/*** LIST VIEW ***/
				drawSearch: function(ForObject) {
					ForObject.drawList();					
					if('list' == ForObject.CurrentView) {
						ForObject.showList();
					}
				},
				generateShowList: function(ForObject) {
					return function() {
						ForObject.showList();
						return false;
					}
				},								
											
				
				/*** DETAILS ***/
				generateDetailsToggle: function(ForObject, DetailsId) {
					return function() {
						Cricket.Util.showDetails(ForObject, DetailsId);
						return false;
					}
				},
				showDetails: function (ForObject, MatchId) {
					//show loader
					
					var MatchIndex = Cricket.Util.matchIndex(ForObject, MatchId);
					if(-1 !== MatchIndex) {
						var Match = ForObject.ParsedFeed[MatchIndex];
						if(typeof Match == 'object') {
							if(false === Match.ScoreCardLoaded) {	
								Cricket.Data.getScoreCard(ForObject, MatchIndex, ForObject.drawDetails, MatchIndex);
							} else {
								ForObject.drawDetails(MatchIndex);
							}
						} 
					} 
				},
				

				/*** SCORE CARD ***/
				generateToggleInningSection: function(ListId) {
					return function() {
						Cricket.Util.toggleInningsSection(ListId);
						return false;
					}
				},
				toggleInningsSection: function(ListId) {
					if(_gel(ListId)) {
						if('collapsed' == _gel(ListId).className) {
							_gel(ListId).className = 'expanded';
						} else {
							_gel(ListId).className = 'collapsed';
						}
					}
				},
				
				generateToggleScoreCard: function(Tab, Direction) {
					switch(Direction) {
						case 'show':
							var Func = function() {
								Cricket.Util.showScoreCard(Tab);
								return false;
							};
							return Func;
						case 'hide':
							var Func = function() {
								Cricket.Util.hideScoreCard(Tab);
								return false;
							};
							return Func;
							
						default:
							return function() {
								return false;
							};
					}
				},
				showScoreCard: function(Tab) {
					if(_gel(Tab+'-details-scorecard')) {
						_gel(Tab+'-details-scorecard').style.display = 'block';
					}
					if(_gel(Tab+'-details-general')) {
						_gel(Tab+'-details-general').style.display = 'none';
					}
				},
				hideScoreCard: function(Tab) {
					if(_gel(Tab+'-details-scorecard')) {
						_gel(Tab+'-details-scorecard').style.display = 'none';
					}
					if(_gel(Tab+'-details-general')) {
						_gel(Tab+'-details-general').style.display = 'block';
					}
				},
				matchIndex: function(ForObject, MatchId) {
					var LookIn = ForObject.ParsedFeed;	
					if(false !== LookIn) {
						for(var i = 0; i < LookIn.length; i++) {
							if(MatchId == LookIn[i].Id) {
								return i;
							}
						}
					}
					return -1;
				},
				generateRandom: function() {
					var CurDate = new Date();
					return CurDate.getTime();
				},
				
				drawScoreCard: function(Match, ScorecardContainer, TabId) {
					//SCORECARD
					//INIT INFO
					var WonBy = '';
					var WonByLabel = '';
					if(0 == Match.Result.WinningTeam) {
						var LoosingTeam = 0;
					} else {
						var LoosingTeam = (1 === Match.Result.WinningTeam) ? 2 : 1;
					}
					if('' !== Match.Result.WonByRuns) {
						WonBy = Match.Result.WonByRuns;
						WonByLabel = 'runs';
					}
					if('' !== Match.Result.WonByWickets) {
						WonBy = Match.Result.WonByWickets;
						WonByLabel = 'wickets';
					}
					var SC_WinnerDiv = document.createElement('div');
					SC_WinnerDiv.className = 'large-green-header-centered';
					if(0 !== Match.Result.WinningTeam) {
						SC_WinnerDiv.innerHTML = Match.Teams[Match.Result.WinningTeam].fullname + ' beat ' +Match.Teams[LoosingTeam].fullname + ' by '+WonBy + ' ' + WonByLabel;
						if(false !== Match.ScoreCard && Match.ScoreCard.CurrentScores.Revised && '' != Match.ScoreCard.CurrentScores.Revised.Reason) {
							SC_WinnerDiv.innerHTML += '<br />' + Match.ScoreCard.CurrentScores.Revised.Reason;
						}
					} else {
						SC_WinnerDiv.innerHTML = 'Match Status: ' + Match.Result.Status;
					}
					ScorecardContainer.appendChild(SC_WinnerDiv);
					if(false !== Match.ScoreCard) {
						//scorecard header						
						//clear existing Innings
						InningsDropDown = _gel(TabId+'-scorecard-dropdown');
						InningsCounter = [];
						InningsCounter[0] = 0;
						InningsCounter[1] = 1;
						InningsCounter[2] = 1;
						if(InningsDropDown) {
							InningsDropDown.innerHTML = '';
							for(var i = 1; i < Match.ScoreCard.Innings.length; i++) {
								var InningsOption = document.createElement('option');
								InningsOption.value = i;
								
								var FirstOrSecond = (2 === InningsCounter[Match.ScoreCard.Innings[i].BatTeam.TeamNum]) ? 'nd' : 'st';
								switch(Match.Type) {
									case 'ODI':
										InningsOption.innerHTML = Match.Teams[Match.ScoreCard.Innings[i].BatTeam.TeamNum].fullname;
										break;
									case 'TEST':
										InningsOption.innerHTML = Match.Teams[Match.ScoreCard.Innings[i].BatTeam.TeamNum].fullname + ' ' + InningsCounter[Match.ScoreCard.Innings[i].BatTeam.TeamNum] + FirstOrSecond + ' innings';
										break;
								}
								//InningsOption.innerHTML = Match.Teams[Match.ScoreCard.Innings[i].BatTeam.TeamNum].fullname + ' ' + InningsCounter[Match.ScoreCard.Innings[i].BatTeam.TeamNum] + FirstOrSecond + ' innings';
								InningsCounter[Match.ScoreCard.Innings[i].BatTeam.TeamNum]++;
								InningsDropDown.appendChild(InningsOption);
							}
						}
						for(var inn = 1; inn < Match.ScoreCard.Innings.length; inn++) {
							
							//SCORE CARD 
							var SC_List = document.createElement('ul');
							SC_List.className = 'table-container';
							SC_List.id = TabId+'-details-scorecard-innings-'+inn;
							SC_List.style.display = 'none';
						
							
							//score card header
							SC_ScoreCardData = document.createElement('li');
							SC_ScoreCardData.id = TabId+'-details-scorecard-innings-sc-'+inn;
							SC_ScoreCardData.className = 'collapsed';
							SC_List.appendChild(SC_ScoreCardData);

							var SC_ScorecardTable = document.createElement('table');
							SC_ScorecardTable.className = 'full-width-table';
							SC_ScorecardTable.id = 'scorecard-table';
							SC_ScoreCardData.appendChild(SC_ScorecardTable);
							
							var SC_ScorecardTBody = document.createElement('tbody');
							SC_ScorecardTBody.className = 'normal-white-text';
							SC_ScorecardTable.appendChild(SC_ScorecardTBody);
							
							var SC_ScorecardHeaderRowExpanded = document.createElement('tr');
							SC_ScorecardHeaderRowExpanded.className = 'table-header row-in-expanded';

							var Cell1 =document.createElement('th');
							Cell1.className = 'cell-1';
							SC_ScorecardHeaderRowExpanded.appendChild(Cell1);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.innerHTML = '<img id="scorecard-header-arrow" src="'+BaseUrl+'/img/arrow-down-small.png" />&nbsp;Scorecard';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-sc-'+inn);
							Cell1.appendChild(ToggleLink);
							
							var Cell2 =document.createElement('th');
							Cell2.className = 'cell-2';
							Cell2.innerHTML = '&nbsp;';
							//Cell2.style.display = 'auto';
							SC_ScorecardHeaderRowExpanded.appendChild(Cell2);

							var Cell3 =document.createElement('th');
							Cell3.className = 'cell-3';
							//Cell3.style.display = 'auto';
							Cell3.innerHTML = 'Runs'
							SC_ScorecardHeaderRowExpanded.appendChild(Cell3);
							
							var Cell4 =document.createElement('th');
							Cell4.className = 'cell-4';
							//Cell4.style.display = 'auto';
							Cell4.innerHTML = 'Balls'
							SC_ScorecardHeaderRowExpanded.appendChild(Cell4);
							
							var Cell5 =document.createElement('th');
							Cell5.className = 'cell-5';
							//Cell5.style.display = 'auto';
							Cell5.innerHTML = '4s'
							SC_ScorecardHeaderRowExpanded.appendChild(Cell5);
							
							var Cell6 =document.createElement('th');
							Cell6.className = 'cell-last';
							//Cell6.style.display = 'auto';
							Cell6.innerHTML = '6s'
							SC_ScorecardHeaderRowExpanded.appendChild(Cell6);
							SC_ScorecardTBody.appendChild(SC_ScorecardHeaderRowExpanded);
							
							
							var SC_ScorecardHeaderRowCollapsed = document.createElement('tr');
							SC_ScorecardHeaderRowCollapsed.className = 'table-header row-in-collapsed';
							
							var Cell1 =document.createElement('th');
							Cell1.className = 'cell-1';
							SC_ScorecardHeaderRowCollapsed.appendChild(Cell1);	
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.innerHTML = '<img id="scorecard-header-arrow" src="'+BaseUrl+'/img/arrow-right-small.png" />&nbsp;Scorecard ';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-sc-'+inn);
							Cell1.appendChild(ToggleLink);
								
							var Cell2 = document.createElement('th');
							Cell2.className = 'cell-last';
							Cell2.colSpan = '5';
							
							var ExpandContainer = document.createElement('p');
							ExpandContainer.className = 'expandlabel';
							Cell2.appendChild(ExpandContainer);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';							
							ToggleLink.className = 'expandlabel';
							ToggleLink.innerHTML = 'expand';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-sc-'+inn);
							ExpandContainer.appendChild(ToggleLink);
							
							//Cell2.style.display = 'auto';
							SC_ScorecardHeaderRowCollapsed.appendChild(Cell2);
							
							SC_ScorecardTBody.appendChild(SC_ScorecardHeaderRowCollapsed);     

							//score card table					
							for(var scr = 0; scr < Match.ScoreCard.Innings[inn].BatTeam.Players.length; scr ++) {
								var SC_ScorecardRow = document.createElement('tr');
								SC_ScorecardRow.className = (0 == scr%2) ? 'row-dark row-in-expanded' : 'row-light row-in-expanded';
								
								var Cell1 =document.createElement('td');
								Cell1.className = 'cell-1';
								Cell1.innerHTML = Match.ScoreCard.Innings[inn].BatTeam.Players[scr].FullName;
								SC_ScorecardRow.appendChild(Cell1);
								
								var Cell2 =document.createElement('td');
								Cell2.className = 'cell-2';
								//Cell2.style.display = 'auto';
								Cell2.innerHTML = Match.ScoreCard.Innings[inn].BatTeam.Players[scr].OutDescription;
								SC_ScorecardRow.appendChild(Cell2);

								var Cell3 =document.createElement('td');
								Cell3.className = 'cell-3';
								//Cell3.style.display = 'auto';
								Cell3.innerHTML = Match.ScoreCard.Innings[inn].BatTeam.Players[scr].Runs;
								SC_ScorecardRow.appendChild(Cell3);
								
								var Cell4 =document.createElement('td');
								Cell4.className = 'cell-4';
								//Cell4.style.display = 'auto';
								Cell4.innerHTML = Match.ScoreCard.Innings[inn].BatTeam.Players[scr].Balls;
								SC_ScorecardRow.appendChild(Cell4);
								
								var Cell5 =document.createElement('td');
								Cell5.className = 'cell-5';
								//Cell5.style.display = 'auto';
								Cell5.innerHTML = Match.ScoreCard.Innings[inn].BatTeam.Players[scr].Fours;
								SC_ScorecardRow.appendChild(Cell5);
								
								var Cell6 =document.createElement('td');
								Cell6.className = 'cell-last';
								//Cell6.style.display = 'auto';
								Cell6.innerHTML = Match.ScoreCard.Innings[inn].BatTeam.Players[scr].Sixes;
								SC_ScorecardRow.appendChild(Cell6);
								
								SC_ScorecardTBody.appendChild(SC_ScorecardRow);
								
								var SC_Spacer = document.createElement('tr');
								SC_Spacer.className = 'scpacer row-in-expanded';
								SC_ScorecardTBody.appendChild(SC_Spacer);
							}							

							//Fall of wickets
							SC_FowData = document.createElement('li');
							SC_FowData.id = TabId+'-details-scorecard-innings-fow-'+inn;
							SC_FowData.className = 'collapsed';
							SC_List.appendChild(SC_FowData);
							
							var SC_FowTable = document.createElement('table');
							SC_FowTable.className = 'full-width-table';
							SC_FowTable.id = 'fallofwickets-table';
							SC_FowData.appendChild(SC_FowTable);
							
							var SC_FowTBody = document.createElement('tbody');
							SC_FowTBody.className = 'normal-white-text';
							SC_FowTable.appendChild(SC_FowTBody);
							
							var SC_FowHeaderRow = document.createElement('tr');
							SC_FowHeaderRow.className = 'table-header row-in-expanded';
							SC_FowTBody.appendChild(SC_FowHeaderRow);
							
							var Cell1 =document.createElement('th');
							Cell1.className = 'cell-1';
							SC_FowHeaderRow.appendChild(Cell1);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.innerHTML = '<img id="scorecard-header-arrow" src="'+BaseUrl+'/img/arrow-down-small.png" />&nbsp;Fall of wickets';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-fow-'+inn);
							Cell1.appendChild(ToggleLink);
							
							var Cell2 =document.createElement('th');
							Cell2.className = 'cell-last';
							//Cell2.style.display = 'auto';
							SC_FowHeaderRow.appendChild(Cell2);
							
							var SC_FowHeaderRow = document.createElement('tr');
							SC_FowHeaderRow.className = 'table-header row-in-collapsed';
							SC_FowTBody.appendChild(SC_FowHeaderRow);
							
							var Cell1 =document.createElement('th');
							Cell1.className = 'cell-1';
							SC_FowHeaderRow.appendChild(Cell1);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.innerHTML = '<img id="scorecard-header-arrow" src="'+BaseUrl+'/img/arrow-right-small.png" />&nbsp;Fall of wickets';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-fow-'+inn);
							Cell1.appendChild(ToggleLink);
							
							var Cell2 =document.createElement('th');
							Cell2.className = 'cell-last';
							
							var ExpandContainer = document.createElement('p');
							ExpandContainer.className = 'expandlabel';
							Cell2.appendChild(ExpandContainer);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.className = 'expandlabel';
							ToggleLink.innerHTML = 'expand';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-fow-'+inn);
							ExpandContainer.appendChild(ToggleLink);
							
							//Cell2.style.display = 'auto';
							SC_FowHeaderRow.appendChild(Cell2);
							
							//fall of wickets table
							
							for(var fow = 0; fow < Match.ScoreCard.Innings[inn].FallOfWickets.length; fow ++) {
								var SC_FowRow = document.createElement('tr');
								SC_FowRow.className = (0 == fow%2) ? 'row-dark row-in-expanded' : 'row-light row-in-expanded';
								
								var Cell1 =document.createElement('td');
								Cell1.className = 'cell-1';
								Cell1.innerHTML = Match.ScoreCard.Innings[inn].FallOfWickets[fow].BatsMan;
								SC_FowRow.appendChild(Cell1);
								
								var Cell2 =document.createElement('td');
								Cell2.className = 'cell-last';
								//Cell2.style.display = 'auto';
								Cell2.innerHTML = Match.ScoreCard.Innings[inn].FallOfWickets[fow].Nbr + ' / ' + Match.ScoreCard.Innings[inn].FallOfWickets[fow].Runs;
								SC_FowRow.appendChild(Cell2);
								
								SC_FowTBody.appendChild(SC_FowRow);
								
								var SC_Spacer = document.createElement('tr');
								SC_Spacer.className = 'scpacer row-in-expanded';
								SC_FowTBody.appendChild(SC_Spacer);
							}
							
							//bowling figures
							SC_BfData = document.createElement('li');
							SC_BfData.id = TabId+'-details-scorecard-innings-bf-'+inn;
							SC_BfData.className = 'collapsed';
							SC_List.appendChild(SC_BfData);
							
							var SC_BfTable = document.createElement('table');
							SC_BfTable.className = 'full-width-table';
							SC_BfTable.id = 'bowlingfigures-table';
							SC_BfData.appendChild(SC_BfTable);
							
							var SC_BfTBody = document.createElement('tbody');
							SC_BfTBody.className = 'normal-white-text';
							SC_BfTable.appendChild(SC_BfTBody);
							
							var SC_BfHeaderRow = document.createElement('tr');
							SC_BfHeaderRow.className = 'table-header row-in-expanded';
							SC_BfTBody.appendChild(SC_BfHeaderRow);
							
							var Cell1 =document.createElement('th');
							Cell1.className = 'cell-1';
							SC_BfHeaderRow.appendChild(Cell1);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.innerHTML = '<img id="scorecard-header-arrow" src="'+BaseUrl+'/img/arrow-down-small.png" />&nbsp;Bowling figures';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-bf-'+inn);
							Cell1.appendChild(ToggleLink);
							
							var Cell2 =document.createElement('th');
							Cell2.className = 'cell-2';
							Cell2.innerHTML = 'O';
							//Cell2.style.display = 'auto';
							SC_BfHeaderRow.appendChild(Cell2);
							
							var Cell3 =document.createElement('th');
							Cell3.className = 'cell-3';
							Cell3.innerHTML = 'M';
							//Cell3.style.display = 'auto';
							SC_BfHeaderRow.appendChild(Cell3);
							
							var Cell4 =document.createElement('th');
							Cell4.className = 'cell-4';
							Cell4.innerHTML = 'R';
							//Cell4.style.display = 'auto';
							SC_BfHeaderRow.appendChild(Cell4);
							
							var Cell5 =document.createElement('th');
							Cell5.className = 'cell-5';
							Cell5.innerHTML = 'W';
							//Cell5.style.display = 'auto';
							SC_BfHeaderRow.appendChild(Cell5);
							
							var Cell6 =document.createElement('th');
							Cell6.className = 'cell-6';
							Cell6.innerHTML = 'Wd';
							//Cell6.style.display = 'auto';
							SC_BfHeaderRow.appendChild(Cell6);
							
							var Cell7 =document.createElement('th');
							Cell7.className = 'cell-last';
							Cell7.innerHTML = 'Nb';
							//Cell7.style.display = 'auto';
							SC_BfHeaderRow.appendChild(Cell7);
							
							var SC_BfHeaderRow = document.createElement('tr');
							SC_BfHeaderRow.className = 'table-header row-in-collapsed';
							SC_BfTBody.appendChild(SC_BfHeaderRow);
							
							var Cell1 =document.createElement('th');
							Cell1.className = 'cell-1';
							SC_BfHeaderRow.appendChild(Cell1);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.innerHTML = '<img id="scorecard-header-arrow" src="'+BaseUrl+'/img/arrow-right-small.png" />&nbsp;Bowling figures';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-bf-'+inn);
							Cell1.appendChild(ToggleLink);
							
							var Cell2 =document.createElement('th');
							Cell2.className = 'cell-last';
							Cell2.colSpan = '6';
							
							var ExpandContainer = document.createElement('p');
							ExpandContainer.className = 'expandlabel';
							Cell2.appendChild(ExpandContainer);
							
							var ToggleLink = document.createElement('a');
							ToggleLink.href='#';
							ToggleLink.className = 'expandlabel';
							ToggleLink.innerHTML = 'expand';
							ToggleLink.onclick = Cricket.Util.generateToggleInningSection(TabId+'-details-scorecard-innings-bf-'+inn);
							ExpandContainer.appendChild(ToggleLink);
							
							//Cell2.style.display = 'auto';
							SC_BfHeaderRow.appendChild(Cell2);
							
							//bowling figures table	
							for(var bf = 0; bf < Match.ScoreCard.Innings[inn].BowlTeam.Players.length; bf ++) {
								var SC_BfRow = document.createElement('tr');
								SC_BfRow.className = (0 == bf%2) ? 'row-dark row-in-expanded' : 'row-light row-in-expanded';
								
								var Cell1 =document.createElement('td');
								Cell1.className = 'cell-1';
								Cell1.innerHTML = Match.ScoreCard.Innings[inn].BowlTeam.Players[bf].FullName;
								SC_BfRow.appendChild(Cell1);
								
								var Cell2 =document.createElement('td');
								Cell2.className = 'cell-2';
								//Cell2.style.display = 'auto';
								Cell2.innerHTML = Match.ScoreCard.Innings[inn].BowlTeam.Players[bf].Overs;
								SC_BfRow.appendChild(Cell2);

								var Cell3 =document.createElement('td');
								Cell3.className = 'cell-3';
								//Cell3.style.display = 'auto';
								Cell3.innerHTML = Match.ScoreCard.Innings[inn].BowlTeam.Players[bf].Maidens;
								SC_BfRow.appendChild(Cell3);
								
								var Cell4 =document.createElement('td');
								Cell4.className = 'cell-4';
								//Cell4.style.display = 'auto';
								Cell4.innerHTML = Match.ScoreCard.Innings[inn].BowlTeam.Players[bf].RunsOff;
								SC_BfRow.appendChild(Cell4);
								
								var Cell5 =document.createElement('td');
								Cell5.className = 'cell-5';
								//Cell5.style.display = 'auto';
								Cell5.innerHTML = Match.ScoreCard.Innings[inn].BowlTeam.Players[bf].Wickets;
								SC_BfRow.appendChild(Cell5);
								
								var Cell6 =document.createElement('td');
								Cell6.clasName = 'cell-6';
								//Cell6.style.display = 'auto';
								Cell6.innerHTML = Match.ScoreCard.Innings[inn].BowlTeam.Players[bf].Wides;
								SC_BfRow.appendChild(Cell6);
								
								var Cell7 =document.createElement('td');
								Cell7.className = 'cell-last';
								//Cell7.style.display = 'auto';
								Cell7.innerHTML = Match.ScoreCard.Innings[inn].BowlTeam.Players[bf].NoBalls;
								SC_BfRow.appendChild(Cell7);
								
								SC_BfTBody.appendChild(SC_BfRow);
								
								var SC_Spacer = document.createElement('tr');
								SC_Spacer.className = 'scpacer row-in-expanded';
								SC_BfTBody.appendChild(SC_Spacer);
							}								
							
							ScorecardContainer.appendChild(SC_List);
						}
					} else {
						var MessageContainer = document.createElement('div');
						MessageContainer.appendChild(document.createTextNode('Detailed match information is not currently available'));
						MessageContainer.className = 'error-message';
						ScorecardContainer.appendChild(MessageContainer);
					}
				},
				sortDates: function(a, b) {
					var aArray = a.split('-');
					var aMonths = 99;
					var bMonths = 99;
					if(aArray[0]) {
						aMonths = parseInt(aArray[0]);
					}
					var bArray = b.split('-');
					if(bArray[0]) {
						bMonths = parseInt(bArray[0]);
					}
					return aMonths - bMonths; 
				}
			}